Elder’s Force Index (FI) v2: Technical Indicator for Market Momentum Analysis

Table of Contents

Elder’s Force Index (FI) v2: Technical Indicator for Market Momentum Analysis

Introduction

The Elder’s Force Index (FI) is a powerful momentum oscillator developed by Dr. Alexander Elder that measures the force (or power) behind price movements by combining price changes and volume. This version 2 implementation enhances the original indicator with improved color visualization to better highlight bullish and bearish momentum shifts.

How It Works

The Force Index uses price movement and volume to assess the strength of market moves. It helps traders identify potential trend reversals, confirm breakouts, and spot divergences.

Formula

The Elder’s Force Index is calculated using the following formula:

Raw Force Index = (Current Close - Previous Close) × Volume

To reduce market noise, an Exponential Moving Average (EMA) is applied:

Smoothed Force Index = EMA(Raw Force Index, Length)

Where Length is typically set to 13 periods (default) but can be adjusted based on trading preferences.

Interpretation

  1. Positive Force Index (Green): Indicates bullish momentum where buyers are in control
  2. Negative Force Index (Red): Indicates bearish momentum where sellers are in control
  3. Zero Line Crossovers: Potential shift in short-term momentum
  4. Divergences: When price makes new highs/lows but Force Index doesn’t confirm

Trading Strategies

The Force Index can be used in several trading approaches:

  1. Trend Confirmation: A sustained positive Force Index confirms an uptrend, while a sustained negative value confirms a downtrend
  2. Zero Line Strategy: Buy when the Force Index crosses above zero, sell when it crosses below
  3. Divergence Trading: Look for divergences between price action and the Force Index to identify potential reversals
  4. Volume Surge Analysis: Extreme Force Index readings indicate high volume price moves that may signal the beginning of a new trend

Code Implementation

Indie Version (v5)

#education purpose
# indie:lang_version = 5
from indie import indicator, plot, color, param, MutSeriesF
from indie.algorithms import Ema

@indicator("Elder's Force Index (FI)", overlay_main_pane=False)
@param.int('length', default=13, min=1, title='EMA Length')
@plot.line(id='#plot_0')
def Main(self, length):
    # Create a mutable time series for the Force Index
    fi_series = MutSeriesF.new((self.close[0] - self.close[1]) * self.volume[0])
    
    # Apply exponential smoothing
    smoothed_fi = Ema.new(fi_series, length)[0]

    # Determine the color of the indicator line
    fi_color = color.GREEN if smoothed_fi > 0 else color.RED

    return plot.Line(smoothed_fi, color=fi_color)

PineScript Version (v5)

//@version=5
indicator("Elder's Force Index (FI)", overlay=false)

// Input parameter
length = input.int(13, "EMA Length", minval=1)

// Calculate Force Index
fi_series = (close - close[1]) * volume

// Apply exponential smoothing
smoothed_fi = ta.ema(fi_series, length)

// Plot the indicator with color based on value
plot(smoothed_fi, "Force Index", color=smoothed_fi > 0 ? color.green : color.red)

Syntax Comparison: PineScript vs. Indie

For developers transitioning from PineScript to Indie, here are the key syntax differences:

  1. Module Imports: Indie requires explicit imports (from indie import...) while PineScript has built-in functions
  2. Series Handling:
    • PineScript implicitly handles time series data
    • Indie requires explicit indexing with [0], [1] for accessing current and historical values
  3. Parameter Declaration:
    • PineScript: length = input.int(13, "EMA Length", minval=1)
    • Indie: @param.int('length', default=13, min=1, title='EMA Length')
  4. Series Creation:
    • PineScript automatically creates series from expressions
    • Indie requires explicit series creation using MutSeriesF.new()
  5. Function Structure:
    • PineScript uses global scope
    • Indie uses a function-based approach with a Main function that takes parameters
  6. Plotting:
    • PineScript: plot() function calls
    • Indie: Uses decorators for plot settings and returns values or plot objects

Advantages of Indie

  1. Type Safety: Indie’s explicit typing helps catch errors during development
  2. Modularity: Imports and function-based approach encourage better code organization
  3. Object-Oriented: Support for classes and objects allows for more sophisticated indicators
  4. Python Compatibility: Familiar syntax for Python developers
  5. Explicit Series Handling: While more verbose, the explicit series handling makes data flow clearer

Customization Options

The Force Index can be customized by:

  1. Adjusting the length parameter (shorter for faster signals, longer for smoother trends)
  2. Applying additional smoothing for noise reduction
  3. Adding bands or thresholds to identify overbought/oversold conditions
  4. Combining with other indicators for confirmation signals